import SockJS from 'sockjs'
import Stomp from 'stompjs'

let stompClient = null

export function getFreightCountListWithWebSocketDay () {
  var url = 'https://www.x-link.cc/xliance'
  var socket = new SockJS(url, undefined, {protocols_whitelist: ['websocket']})
  var stompClient = Stomp.over(socket)
  stompClient.connect({}, function (frame) {
    stompClient.subscribe('/topic/getFreightCountListWithWebSocketDay', function (message) {
      console.log(JSON.parse(message.body))
    })
  })
}

export function stopFreightCountListWithWebSocketDay () {
  if (stompClient != null) {
    stompClient.disconnect()
  }
}

export function getFreightCountListWithWebSocketMonth () {}

export function stopFreightCountListWithWebSocketMonth () {}

export function getFreightCountListWithWebSocketYear () {}

export function stopFreightCountListWithWebSocketYear () {}

export function getAllStationBillListWithSocketDay () {}

export function stopAllStationBillListWithSocketDay () {}

export function getAllStationBillListWithSocketMonth () {}

export function stopAllStationBillListWithSocketMonth () {}

export function getAllStationBillListWithSocketYear () {}

export function stopAllStationBillListWithSocketYear () {}
